package com.hencoder.a09_bitmap_drawable;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LightingColorFilter;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

public class DrawableView extends View {
    Drawable drawable;

    public DrawableView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    {
        drawable = new MeshDrawable();
//        drawable.setAlpha(120);
//        ColorFilter colorFilter = new LightingColorFilter(0x00ffff, 0x000000);
//        drawable.setColorFilter(colorFilter);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

//        drawable.setBounds(0, 0, getWidth(), getHeight());
//        drawable.setBounds((int) Utils.dpToPixel(100), (int) Utils.dpToPixel(100),
//                getWidth(), getHeight());
        drawable.setBounds(10, 10,
                getWidth(), getHeight());
        drawable.draw(canvas);
    }
}
